<#import "/admin/_layout.html" as layout>
<@layout.header "权限"></@layout.header>
<@layout.body>
    <div class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-left">
                        <li class="breadcrumb-item"><a href="#">权限</a></li>
                        <li class="breadcrumb-item active">列表</li>
                    </ol>
                </div>
            </div>
        </div>
    </div>
    <section class="content">
        <div class="container-fluid">
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-body">
                            <div class="row">
                                <a id="syncPermissions" href="javascript:void(0)" class="btn btn-info"><i class="fas fa-plus"></i> 同步</a>
                            </div>
                            <table class="table table-hover" style="width:100%">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>名称</th>
                                        <th>URL</th>
                                        <th>权限值</th>
                                        <th>排序</th>
                                        <th>类型</th>
                                    </tr>
                                </thead>
                                <#list pageData.records as item>
                                    <tr>
                                        <td>${item.id!}</td>
                                        <td>${item.name!}</td>
                                        <td>${item.url!}</td>
                                        <td>${item.permInfo!}</td>
                                        <td>${item.sortNum!}</td>
                                        <td>${item.type!}</td>
                                    </tr>
                                </#list>
                            </table>
                            <@layout._adminPage/>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>
</@layout.body>
<@layout.script>
    <script>
        $("#syncPermissions").click(function(){

            layer.confirm('确定要同步权限菜单吗?', {
                btn : ['确定', '取消']
            }, function(i) {
                layer.close(i);
                ajaxPost("/admin/role/doSyncPermission", {}, function(result){
                    alertSuccess("同步成功", function(){
                        location.reload();
                    })
                })
            });

        })
    </script>
</@layout.script>